package com.mybdqn.service;

import com.mybdqn.pojo.User;
import com.mybdqn.dao.UserMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
* Service Class User
*
* 2017-12-14
*/

@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Transactional(readOnly = true)
    public User getUserById(Integer id)throws Exception{
        return userMapper.getUserById(id);
    }

    @Transactional(readOnly = true)
    public List<User> getUserListByMap(Map<String,Object> param)throws Exception {
        return userMapper.getUserListByMap(param);
    }
    
    @Transactional(readOnly = true)
    public Integer getUserRecCountByMap(Map<String,Object> param)throws Exception {
    	return userMapper.getUserRecordCount(param);
    }
    

    public Integer insertUser(User user)throws Exception {
        return userMapper.insertUser(user);
    }

    public Integer updateUser(User user)throws Exception {
        return userMapper.updateUser(user);
    }

    public Integer deleteUserById(Integer id)throws Exception {
        return userMapper.deleteUserById(id);
    }
}